Ext.extend(app.module,{
    init: function(){
        main = this;
        this.ds = new Ext.data.Store({
            proxy: new Ext.data.HttpProxy({url:'paper/getPaperforLook.do'}),
            reader: new Ext.data.JsonReader({
                root: 'rows',
                idProperty: 'id'
            },[
                {name:'id'},
                {name:'name'},
                {name:'kemuname'},
                {name:'state'},
                {name:'scorestate'},
                {name:'kgtmark'},
                {name:'zgtmark'},
                {name:'dztmark'},
                {name:'totalmark'}
            ])
        });
        this.body = new Ext.grid.GridPanel({
            store: this.ds,
            region: 'center',
            loadMask: true,
            viewConfig:{
                forceFit:true
            },
            sm: this.sm,
            columns: [
                new Ext.grid.RowNumberer(),
                {
                    xtype: 'gridcolumn',
                    align: 'center',
                    dataIndex: 'name',
                    header: '试卷名称'
                },
                {
                    xtype: 'gridcolumn',
                    align: 'center',
                    dataIndex: 'kemuname',
                    header: '科目'
                },
                {
                    xtype: 'gridcolumn',
                    align: 'center',
                    dataIndex: 'state',
                    header: '试卷状态',
                    hidden:true
                },
                {
                    xtype: 'gridcolumn',
                    align: 'center',
                    dataIndex: 'scorestate',
                    header: '试卷状态',
                    renderer: function(value,cellmeta,record,rowIndex,columnIndex,store){
                        if (record.data.state==3){
                            return "考试已经结束，请等待发放成绩";
                        } else if (record.data.state==4){
                            return "考试成绩已经发放";
                        } else if(value==4){
                            return "你已经交卷，请等待发放成绩！";
                        }
                    }
                },
                {
                    xtype: 'gridcolumn',
                    align: 'center',
                    dataIndex: 'kgtmark',
                    header: '客观题分数'
                },
                {
                    xtype: 'gridcolumn',
                    align: 'center',
                    dataIndex: 'zgtmark',
                    header: '主观题分数'
                },
                {
                    xtype: 'gridcolumn',
                    align: 'center',
                    dataIndex: 'zgtmark',
                    header: '打字题分数'
                },
                {
                    xtype: 'gridcolumn',
                    align: 'center',
                    dataIndex: 'id',
                    header: 'id',
                    hidden: true
                }
            ]
        });
        this.main.add(this.body);
        this.main.doLayout();
        this.ds.load();
    }
})